package com.google.code.task;

public enum TaskResultType {
  SUCCESS,
  FAILURE,
  FAILOVER,
  STOPPED,
  DELEGATION;
  
  static boolean isSuccess(TaskResultType result) {
    return result == SUCCESS ||
           result == FAILOVER ||
           result == DELEGATION;
  }
  
  public static void validateTaskResult(TaskResultType result) {
    if (TaskResultType.isSuccess(result) == false) {
      throw new FailedTaskException("Failed task. Result is " + result);
    }
  }
}
